package com.demo.controller;

import com.demo.common.Result;
import com.demo.exception.CustomException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WebController {

    @GetMapping("/hello")
    public Result hello() {
        return Result.success("Hello");
    }

    /**
     *抛出自定义错误
     */
    @GetMapping("/custom_err")
    public Result custom_err() {
        throw new CustomException("500", "这是一个自定义错误");
    }
}
